import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { XhljActivityForm, XhljActivityQuery, XhljActivityVo } from '@/api/xhlj/model/activityModel';
import { request } from '@/utils/request';

// 查询活动列表
export function listActivity(query?: XhljActivityQuery) {
  return request.get<TableDataInfo<XhljActivityVo>>({
    url: '/xhlj/activity/list',
    params: query,
  });
}

// 查询活动详细
export function getActivity(activityId: number) {
  return request.get<R<XhljActivityVo>>({
    url: `/xhlj/activity/${activityId}`,
  });
}

// 新增活动
export function addActivity(data: XhljActivityForm) {
  return request.post<R<void>>({
    url: '/xhlj/activity',
    data,
  });
}

// 修改活动
export function updateActivity(data: XhljActivityForm) {
  return request.put<R<void>>({
    url: '/xhlj/activity',
    data,
  });
}

// 删除活动
export function delActivity(activityIds: number | Array<number>) {
  return request.delete<R<void>>({
    url: `/xhlj/activity/${activityIds}`,
  });
}
